import time
from pywinauto.application import Application

# #启动应⽤程序
#
# Application(backend="uia").start("notepad.exe")
# time.sleep(3)
# app = Application(backend="uia").connect(title_re=".*Notepad")
# #获取窗⼝
#
# notepad = app.window(title_re=".*Notepad")
# #操作控件
#
# #输⼊⽂本
#
# notepad.Document.type_keys("Hello, Pywinauto!")
# #关闭应⽤程序
#
# notepad.close()

# Application(backend="uia").start("notepad.exe")
app = Application(backend="uia").start("D:\Program Files\Sublime Text\sublime_text.exe")
# print(app)
# print(app.process)
# app = Application(backend="uia").connect(handle=5311814)
# print(app.process)
# 拿到SubLine Test窗口,等待它加载完成
# win = Application(backend="uia").window(title_re=".*Sublime Text.*")
# 等待窗口加载完成
# win.wait("ready")
win = app.window(class_name=".*WINDOW_CLASS")











